<div id="data_page" class="in_page">
    <div class="panel panel-default">
        <div class="panel-body">
            <form class="form-inline">
                <div class="form-group">
                    <label for="exampleInputName2">用户名</label>
                    <input id="username" value="{$username}" type="text" name="username" class="form-control"  placeholder="输入用户名" />
                    <input value="1" type="hidden" name="p" class="form-control" />
                </div>
                <button type="submit" class="btn btn-sm btn-default">搜索</button>
                <div class="btn-group">
                    <button type="button" onclick="resetData()" class="btn btn-sm btn-primary">重置</button>
                </div>
            </form>
        </div>
    </div>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th>#ID</th>
            <th>用户名</th>
            <th>手机号</th>
            <th>是否有效</th>
            <th>登录次数</th>
            <th>登录时间</th>
            <th>注册时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <volist name="list" id="item">
        <tr>
            <th scope="row">{$item.id}</th>
            <td><img width="30" style="border-radius: 50%; border: 1px solid #666" src="//{$img_url}{$item.headpic}" />{$item.username}</td>
            <td><span style="color: green">{$item.mobile}</span></td>
            <td style="text-align: center">
                <if condition="$item.isvalid eq '0'">
                    <span style="color: red">
                    无效
                    </span>
                </if>
                <if condition="$item.isvalid eq '1'">
                    <span style="color: green">
                    有效
                    </span>
                </if>
            </td>
            <td><span style="color: red">{$item.login_count}</span></td>
            <td  style="text-align: center;width: 140px;">{$item.reg_time|date="Y-m-d H:i",###}</td>
            <td  style="text-align: center;width: 140px;">{$item.login_time|date="Y-m-d H:i",###}</td>
            <td style="text-align: center">
                    <button type="button" onclick="handleItem('{:U('/user/update')}',{$item.id})" class="btn btn-primary btn-xs">修改</button>
            </td>
        </tr>
        </volist>
    </table>
    {$page}
</div>

<script>
    function handleItem(_action,id){
            showIframe(_action+"?id="+id,"修改用户","750px","300px");
    }
    function resetData(){
        $("#username").val("");
    }
</script>